
output:=./build


all: boot.o setup.o
	bximage -q -hd=10M -func=create -sectsize=512 -imgmode=flat $(output)/hd.img
	dd if="$(output)/boot/boot.o" of="$(output)/hd.img" bs=512 count=1 conv=notrunc
	dd if="$(output)/boot/setup.o" of="$(output)/hd.img" bs=512 seek=1 count=4 conv=notrunc

boot.o:
	mkdir -p  $(output)/boot
	nasm -o $(output)/boot/boot.o ./boot/boot.asm

setup.o:
	mkdir -p  $(output)/boot
	nasm -o $(output)/boot/setup.o ./boot/setup.asm


bochs: all
	bochs -q -f bochsrc

qemu: all
	qemu-system-x86_64 \
	-m 4G \
	-boot c \
	-cpu Haswell -smp cores=1,threads=2 \
	-hda ./build/hd.img

qemug: all
	qemu-system-x86_64 \
	-m 4G \
	-boot c \
	-cpu Haswell -smp cores=1,threads=2 \
	-hda ./build/hd.img \
	-s -S

#.PHONY: clean

clean:
	@echo try to clean...
	@rm -r $(output)
	@echo complete!

